package com.atguigu.cloud.apis;

import com.atguigu.cloud.entities.PayDTO;
import com.atguigu.cloud.resp.ResultData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName:    PayFeignApi
 * Package:  com.atguigu.cloud.apis
 * Description:
 *
 * @Author: interface
 * @Create: 2025/7/16 - 下午6:35
 * @Version: v1.0
 */
@FeignClient(value = "cloud-payment-service")
//@FeignClient(value="cloud-gateway")
public interface PayFeignApi {
    /**
     * 新增支付流水
     * @param payDTO
     * @return
     */
    @PostMapping(value = "/pay/add")
    public ResultData<String> addPay(@RequestBody PayDTO payDTO);

    /**
     * 根据 id 删除支付流水
     * @param id
     * @return
     */
    @DeleteMapping(value = "/pay/del/{id}")
    public ResultData<Integer> deletePay(@PathVariable("id") Integer id);

    /**
     * 更新指定的支付流水
     * @param payDTO
     * @return
     */
    @PutMapping(value = "/pay/update")
    public ResultData<String> updatePay(@RequestBody PayDTO payDTO);

    /**
     * 根据id 获取指定的支付流水
     * @param id
     * @return
     */
    @GetMapping(value = "/pay/get/{id}")
    public ResultData getPay(@PathVariable("id") Integer id);

    /**
     * 获取所有的支付流水
     * @return
     */
    @GetMapping(value = "/pay/all")
    public ResultData getAllPay();

    /**
     * 获取 Consul 上的配置信息
     * @return
     */
    @GetMapping(value ="/pay/get/info")
    public ResultData<String> getPayDTO();

    /**
     * Resilience4j CircuitBreaker 的例子
     * @param id
     * @return
     */
    @GetMapping(value = "/pay/circuit/{id}")
    public String myCircuit(@PathVariable("id") Integer id);


    /**
     * Resilience4j Bulkhead 的例子
     * @param id
     * @return
     */
    @GetMapping(value = "/pay/bulkhead/{id}")
    public String myBulkhead(@PathVariable("id") Integer id);

    /**
     * Resilience4j Ratelimit 的例子
     * @param id
     * @return
     */
    @GetMapping(value = "/pay/ratelimit/{id}")
    public String myRatelimit(@PathVariable("id") Integer id);


    /**
     * Micrometer(Sleuth)进行链路监控的例子
     * @param id
     * @return
     */
    @GetMapping(value = "/pay/micrometer/{id}")
    public String myMicrometer(@PathVariable("id") Integer id);

    /**
     * GateWay进行网关测试案例01
     * @param id
     * @return
     */
    @GetMapping(value = "/pay/gateway/get/{id}")
    public ResultData getById(@PathVariable("id") Integer id);

    /**
     * GateWay进行网关测试案例02
     * @return
     */
    @GetMapping(value = "/pay/gateway/info")
    public ResultData<String> getGatewayInfo();
}
